<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" />
<script src="js/app.api.js"></script>
<style type="text/css">
    .redBorder{border: 1px solid red;}
    
    #apps_add_detail_win_feedbacks table td{vertical-align: top; padding-top: 10px; font-size: 12px;}
    #apps_add_detail_win_feedbacks a{color: #00FFFF;}

    #apps_add_detail_win_rate a{cursor:pointer; text-decoration:none;}
    .apps_add_detail_win{position:relative;width: 256px;}
    .white_font_color{color: white;}
    .wp_appstools_detail_hand{
         cursor:pointer;
    }
</style>
<style type="text/css"></style>
<div id="apps_add_detail_win" class="wp_fz_12 apps_add_detail_win" style="color: #FFFFFF;">
    <div id="apps_add_detail_win_content" class="wp_pt_1 wp_h_200" style="background-color: #39BE70;">
        <div id="apps_add_detail_win_content_body" class="wp_ml_15 wp_mr_15 wp_mt_10">
            <!-- top -->
            <span class="left wp_h_70"><img data-bind="attr:{src:detailInfo.AppImage}" alt="" class="wp_w_20 wp_h_20" onerror="this.src='imgs/20x20.png'" /></span>
            <div class="wp_ml_30">
                <span id="apps_add_detail_win_content_name" style="vertical-align: top; line-height: 100%" data-bind="html:detailInfo.shortTitle,attr:{ title: detailInfo.AppTitle}"></span>
                <span style="vertical-align: top; line-height: 100%" class="wp_ml_10">
                    <i id="feedbackCount" class="main_smartstream_u_8_8 wp_mt_3"  onclick="appsAddDetailWinFunc.clickfeedbackcommenticon()"></i> (<span id="apps_add_detail_win_content_launch_count" data-bind="html:detailInfo.FeedbackCount" title="Feedback Count"></span>)
                </span>
            </div>
            <span id="apps_add_detail_win_content_title" class="wp_ml_10" style="vertical-align: top; line-height: 100%">
                Created by 
                <a href="javascript:void(0)" style="text-decoration: none; cursor:pointer; color: #FFFFFF;" data-bind="attr:{onclick:openProfile}">
                    <span  data-bind="html:detailInfo.CreatedBy"></span>
                </a>
            </span>
            <div id="apps_add_detail_win_reviews" class="wp_ml_30">
                <span style="vertical-align: top; line-height: 100%">Reviews</span>
                <i id="oneStars_detail_reviews" class="main_smartstream_h_10_10"></i>
                <i id="twoStars_detail_reviews" class="main_smartstream_h_10_10"></i>
                <i id="threeStarsStars_detail_reviews" class="main_smartstream_h_10_10"></i>
                <i id="fourStars_detail_reviews" class="main_smartstream_h_10_10"></i>
                <i id="fiveStars_detail_reviews" class="main_smartstream_h_10_10"></i>   
                <span style="vertical-align: top; margin-left: 5px; line-height: 100%"><span id="apps_add_detail_rating" data-bind="html:detailInfo.RatingsCount" title="Ratings Count"></span> Rating(s)</span>         
            </div>
            <div class="wp_ml_30 wp_mt_5">
                <span id="apps_add_detail_win_content_users_count" data-bind="html:detailInfo.LaunchCount" title="Launch count"></span> User(s) | 
                    <i id="apps_add_detail_win_like_icon" class="main_smartstream_t_8_8" style="cursor:pointer;" onclick="appsAddDetailWinFunc.like_icon_clicked_event()"></i>
                (<span id="apps_add_detail_win_content_likes_count" data-bind="html:detailInfo.LikesCount" onclick="appsAddDetailWinFunc.like_person_num_clicked_event(this.innerHTML)"></span>)
            </div>
            <!-- middle -->
            <div class="wp_ml_30 wp_mt_5">
                <span>Created Date</span>
                <span id="createdDate" class="wp_ml_10" data-bind="html:detailInfo.CreatedDate"></span>
            </div>
            <div class="wp_ml_30 wp_mt_5">
                <span>Description</span>
                <div id="description" class="wp_ml_81" style="margin-top: -15px; width: 120px; word-wrap: break-word; word-break: normal; padding-bottom: 10px;"  data-bind="html:detailInfo.AppDescription"></div>
            </div>            
        </div>
        <!-- bottom -->
        <div class="wp_mt_10 wp_ml_15 wp_mr_15 wp_w_224">
            <!-- <a href="javascript:void(0)" class="left wp_mt_5" onclick="appsAddDetailWinFunc.apps_add_detail_win_del_click()">
                <i class="main_common_p_10_10"></i>
            </a> -->
            <button id="launch_btn" type="button" class="k-button wp_w_40 wp_h_20 wp_fz_10 right" onclick="appsAddDetailWinFunc.apps_tools_win_create_launch_click()">Launch</button>
            <!-- <button id="apps_tools_detail_edit_button" class="k-button wp_w_40 wp_h_20 wp_fz_10 right wp_mr_15" onclick="appsAddDetailWinFunc.apps_add_detail_win_edit_button_click()">Edit</button> -->
        </div>
    </div>
    <div id="apps_add_detail_win_feedbacks" style="background-color: #36B36A;" class="wp_h_200 wp_pt_1">
        <div class="wp_ml_15 wp_mr_15 left">
            <div class="wp_mt_10 left">
                <div id="apps_add_detail_win_rate">
                    Rate This Application
                    <a href="javascript:void(0)" onclick="appsAddDetailWinFunc.apps_add_detail_win_rate_click(0)">
                        <i id="oneStars" class="main_smartstream_h_10_10"></i>
                    </a>
                    <a href="javascript:void(0)" onclick="appsAddDetailWinFunc.apps_add_detail_win_rate_click(1)">
                        <i id="twoStars" class="main_smartstream_h_10_10"></i>
                    </a>
                    <a href="javascript:void(0)" onclick="appsAddDetailWinFunc.apps_add_detail_win_rate_click(2)">
                        <i id="threeStars" class="main_smartstream_h_10_10"></i>
                    </a>
                    <a href="javascript:void(0)" onclick="appsAddDetailWinFunc.apps_add_detail_win_rate_click(3)">
                        <i id="fourStars" class="main_smartstream_h_10_10"></i>
                    </a>
                    <a href="javascript:void(0)" onclick="appsAddDetailWinFunc.apps_add_detail_win_rate_click(4)">
                        <i id="fiveStars" class="main_smartstream_h_10_10"></i> 
                    </a>
                </div>
                <input id="apps_add_detail_win_comment_input" type="text" class="wp_mt_10 wp_w_224 wp_fz_12 wp_h_20" placeholder="&nbsp; Add a Reply" style="color: #bfbfbf; line-height: 100%;" onclick="appsAddDetailWinFunc.apps_add_detail_win_comment_input_click(this)" />
                <textarea id="apps_add_detail_win_comment_textarea" rows="2" style="display: none;" maxlength="255" class="wp_fz_12 wp_w_224 wp_mt_10 wp_h_34"></textarea>
                <button id="apps_add_detail_win_comment_button" type="button" class="k-button wp_w_40 wp_h_20 wp_fz_10 right wp_mt_10" style="display: none" onclick="appsAddDetailWinFunc.apps_add_detail_win_reply_button_click()">Reply</button>
            </div>        
            <!-- feedback -->
            <div id="apps_add_detail_win_feedbacks_table" class="left" styel="height: 130px;">
                <table id="apps_add_detail_win_comment_table" class="wp_w_228"></table>
            </div>
        </div>
    </div>
</div>
<!-- feedbacks template -->
<script type="text/x-kendo-template" id="apps_add_detail_win_feedbacks_template">
    <tr>
        <td rowspan="3" class="wp_w_20">
            # if (!data.UserImageURL) { #
                # data.UserImageURL = 'imgs/20x20.png'; #
            #}#
            <img id="userImageUrl_feedbacks" src="#: data.UserImageURL #" onclick="homepageProfileWin.user_info_win_create('#: data.UserId#')" title="#: data.UserName #" class="wp_appstools_detail_hand wp_w_20 wp_h_20" onerror="this.src='imgs/20x20.png'" style="margin-top: 0px" />
        </td>
        <td class="wp_pl_10" style="width: 190px;">
            <a id="userName_feedbacks" href="\#" style="text-decoration: none;" onclick="homepageProfileWin.user_info_win_create('#: data.UserId#')" title="#: data.UserName #">#: appsAddDetailWinFunc.shortUsername(data.UserName) #</a>
            # for (var i = 0; i < data.Ratings; i++) { #
                <i id="ratings_feedbacks" class="main_smartstream_g_10_10"></i>
            # } #
            # for (var i = 0; i < (5 - data.Ratings); i++) { #
                <i id="ratings_feedbacks_1" class="main_smartstream_h_10_10"></i>
            # } #
        </td>
    </tr>
    <tr>        
        <td id="feedbackComments_feedbacks" class="wp_pl_10 wp_pt_1" style="word-break: break-all;">
            #: data.FeedbackComments #
        </td>
    </tr>
    <tr>
        <td class="right">
            <!--<div class="right">(<span></span>)</div>
            <i class="main_smartstream_t_8_8 right wp_mr_2 wp_mt_3"></i> -->
            <div id="timeAgo_feedbacks" class="right wp_mr_10">#: data.TimeAgo #</div>
        </td>
    </tr>
</script>

<!-- <div id="dialog">
    <ul style="list-style:none;">
        <li class="wp_ml_20 wp_mr_20"><span class="wp_fz_12">The given rating will not reflect without entering review comments. Are you sure you want to close the po-up?</span></li><li>&nbsp;</li>
        <li class="center"><button id="okButton" type="button" class="k-button wp_w_50 wp_h_20 wp_fz_12 " onClick="appsAddDetailWinFunc.onClickOkBtn()">Yes</button>
            <button id="cancelButton" type="button" class="btn-bf k-button wp_w_50 wp_h_20 wp_fz_12 wp_mr_20 " onClick="appsAddDetailWinFunc.onClickCancelBtn()" >Cancel</button></li>
    </ul>
</div> -->
<!-- function -->
<script type="text/javascript">
    var appsAddDetailWinFunc = (function () {
    // var dialog;
    var useragent = Workport.getBrowser();
    // if(useragent == 'ipad'){
    //     $('#for_ipad').append('#dialog{display:none!important}');
    // }
        //init win
        var appsAddDetailWinUI = $('#apps_add_detail_win'), feedbackTmpl = $('#apps_add_detail_win_feedbacks_template'),
            feedbackTable = $("#apps_add_detail_win_comment_table"), feedbackDiv = $('#apps_add_detail_win_feedbacks_table'),
            feedbackOffset, feedbackGetDataFlag, replyFlag = false, isEnd = false;
            alertTitle = 'Detail alert';
            var loading;
        
        appsAddDetailWinUI.kendoWindow({width:'256px', height: '400px', title: 'Detail', modal: true, visible:false, resizable: false, draggable: false, actions:["Close"], 
            close:function(){
                if(useragent != 'ipad'){
                    $('#apps_add_detail_win_content_body').slimScroll({scrollTo: '0px',disableFadeOut:true});
                    feedbackDiv.slimScroll({scrollTo: '0px',disableFadeOut:true});
                }
                appsAddDetailWinUI.destroy, $(".k-window-titlebar").removeClass("win_title_green");
                wp_apps_tools.closeSearchPanel();
                // if (replyFlag) {
                    wp_apps_tools.refreshAddOrEditByPopWin();
                // }
                if(useragent == 'ipad'){
                    $('body').unbind('touchmove');
                    appsAddDetailWinUI.unbind('touchmove');  
                }
            },
            open:function(){
                 if(useragent == 'ipad'){
                    $('body').bind('touchmove',function(event){event.preventDefault()});
                    appsAddDetailWinUI.bind('touchmove',function(event){event.stopPropagation()});  
                }
            }
        }).data("kendoWindow").center();

        $('#apps_add_detail_win').parents('.k-window').addClass('greenWindow');
        
        var appsAddDetailWinViewModel = kendo.observable({
            detailInfo: "",
            feedbackCount: 0,
            openProfile: ""
        });
        kendo.bind($("#apps_add_detail_win"), appsAddDetailWinViewModel);
        if(useragent == 'ipad'){
            $("#apps_add_detail_win_feedbacks_table").bind("scroll",function(){
                if(($("#apps_add_detail_win_feedbacks_table")[0].scrollHeight <= $("#apps_add_detail_win_feedbacks_table").scrollTop() + $("#apps_add_detail_win_feedbacks_table").height()) && !feedbackGetDataFlag && !isEnd){
                        feedbackGetDataFlag = true;
                        get_feedbacks(feedbackDetail.appId);
                }
            });
        } else{
            feedbackDiv.bind('slimscroll', function(e, pos){
                if (pos == 'bottom' && !feedbackGetDataFlag && !isEnd) {
                    feedbackGetDataFlag = true;
                    get_feedbacks(feedbackDetail.appId);
                }
            });
        }
        

        function get_feedbacks () {
            loading.show();
            var count = 10;
            Workport.AppAPI.showFeedback(function (data) {
                loading.hide();
                if ($.inArray(data.ResponseCode, appsToolsWinResponseSuccessCode) == -1) {
                    alertMsg(data.ResponseMessage);
                } else {
                    if (data.GetAllFb) {
                        isEnd = data.IsEnd;
                        var dataFb=data.GetAllFb;
                        var serveDate=data.ServerTime;
                        for(var i=0;i<dataFb.length;i++){
                            dataFb[i].TimeAgo=Workport.utils.calDays(dataFb[i].ReceivedOn,serveDate);
                        }
                        render(dataFb);
                        feedbackCount = data.GetAllFb.length;
                        feedbackOffset += count;
                        if(useragent != 'ipad'){
                            feedbackDiv.slimScroll({disableFadeOut:true});
                            var feedBackScrollBar=$('#apps_add_detail_win_feedbacks_table').parent().find('.slimScrollBar');
                            var feedbackScrollBarTop=parseInt(feedBackScrollBar.css('top'));
                            if(feedbackScrollBarTop>90){
                                feedBackScrollBar.css('top','90px');
                            }
                        }
                        
                    }
                }
                feedbackGetDataFlag = false;
            }, {"appId": feedbackDetail.appId, "offset": feedbackOffset, "count": count, "type": 1});
        }

        function render (_data) {
            var tmpl = kendo.template($.trim(feedbackTmpl.html())),
                arr = [];
            $.map(_data, function(_elem) {
                arr.push(tmpl(_elem));
            });
            $(arr.join('')).appendTo(feedbackTable);
        }

        function alertMsg (msg) {
            Workport.utils.alertMsg(alertTitle, msg, function(_data){});
        }


        var appsToolsWinResponseSuccessCode = ['WP1022', 'WP1021'];
        var starNum = ["one", "two", "three", "four", "five"];
        var feedbackDetail;

        return {
            shortUsername :function(username){
                var oldtitle=username;
                var newTitle;
                if(oldtitle.length>14){
                    newTitle=oldtitle.slice(0,14);
                    newTitle=newTitle+"...";
                }else{
                    newTitle=oldtitle;
                }
                return newTitle;
            },
            apps_add_detail_win_create : function (appId) {
                feedbackDetail = {"ratings": 0};
                feedbackDetail.appId = appId;
                feedbackOffset = 0;
                feedbackGetDataFlag = false;

                $("#apps_add_detail_win_comment_input").show();
                $("#apps_add_detail_win_comment_textarea").hide();
                $("#apps_add_detail_win_comment_textarea").val("");
                $("#apps_add_detail_win_comment_button").hide();
                $("#apps_add_detail_win_comment_table").html("");
                $("#apps_add_detail_win_rate i").removeAttr("class");
                $("#apps_add_detail_win_rate i").addClass("main_smartstream_h_10_10");
                feedbackDiv.css("height", '130px');
                if(!loading){loading = new Workport.Loader($('#apps_add_detail_win'),{imgColor:'black',textCSS:{'color':'black'}, boxCSS:{'opacity':1}});}
                loading.show();

                Workport.AppAPI.getDetail(function (data) {
                    loading.hide();
                    if(useragent == 'ipad'){
                        $('#apps_add_detail_win_content_body').css('height','160px');
                        $('#apps_add_detail_win_content_body').css('overflow-y','scroll');
                        $('#apps_add_detail_win_content_body').css('overflow-x','hidden');
                    } else{
                        $('#apps_add_detail_win_content_body').slimScroll({wheelStep : 20, height: '160px', scrollTo: '0px',disableFadeOut:true});
                    }
                    var ratingInt = 5;
                    var decimals;
                    if ($.inArray(data.ResponseCode, appsToolsWinResponseSuccessCode) == -1) {
                        alertMsg(data.ResponseMessage);
                    } else {
                        if(data.AppTitle.length>20){
                            shortTitle=data.AppTitle.slice(0,20);
                            shortTitle=shortTitle+"...";
                            data.shortTitle=shortTitle;
                        }else{
                            data.shortTitle=data.AppTitle;
                        }

                        appsAddDetailWinViewModel.set("detailInfo", data);
                        appsAddDetailWinViewModel.set("openProfile", "homepageProfileWin.user_info_win_create('" + data.CreatorID + "')");//open profile
                        if (data.IsLiked) {
                            $("#apps_add_detail_win_like_icon").removeClass("app_tools_f_10_10");
                            $("#apps_add_detail_win_like_icon").addClass("main_smartstream_t_8_8");
                            $("#apps_add_detail_win_like_icon").attr("title","Unlike");
                        } else {
                            $("#apps_add_detail_win_like_icon").removeClass("main_smartstream_t_8_8");
                            $("#apps_add_detail_win_like_icon").addClass("app_tools_f_10_10");
                            $("#apps_add_detail_win_like_icon").attr("title","Like");
                        }
                        //like counts is 0
                        if(data.LikesCount>0){
                            $('#apps_add_detail_win_content_likes_count').css("cursor","pointer");
                        }else{
                            $('#apps_add_detail_win_content_likes_count').css("cursor","");
                        }

                        if (data.Ratings > 0) {
                            ratingInt = Math.floor(data.Ratings);
                            decimals = data.Ratings.toFixed(2) - ratingInt;
                            for (var i = 0; i < 5; i++) {
                                if (i < ratingInt) {
                                    $("#apps_add_detail_win_reviews i:eq(" + i + ")").removeClass("main_smartstream_h_10_10");
                                    $("#apps_add_detail_win_reviews i:eq(" + i + ")").addClass("main_smartstream_g_10_10");
                                } else {
                                    if (i == ratingInt && decimals > 0) {
                                        $("#apps_add_detail_win_reviews i:eq(" + i + ")").removeClass("main_smartstream_g_10_10, main_smartstream_h_10_10");
                                        $("#apps_add_detail_win_reviews i:eq(" + i + ")").addClass("main_common_r_10_10");
                                    } else {
                                        $("#apps_add_detail_win_reviews i:eq(" + i + ")").removeClass("main_smartstream_g_10_10");
                                        $("#apps_add_detail_win_reviews i:eq(" + i + ")").addClass("main_smartstream_h_10_10");
                                    }
                                }                                
                            }
                        } else {
                            for (var i = 0; i < ratingInt; i++) {
                                $("#apps_add_detail_win_reviews i:eq(" + i + ")").removeAttr("class");
                                $("#apps_add_detail_win_reviews i:eq(" + i + ")").addClass("main_smartstream_h_10_10");
                            }
                        }
                    }
                }, {"appId": appId});
                
                get_feedbacks();

                if(useragent == 'ipad'){
                    $('#apps_add_detail_win_feedbacks').css('height','198px')
                    feedbackDiv.css('width','228px');
                    feedbackDiv.css('height','130px');
                    feedbackDiv.css('overflow-y','scroll');

                }else{
                    feedbackDiv.slimScroll({width: '228px', height: '130px', wheelStep : 20, scrollTo: '0px',disableFadeOut:true});
                }
                appsAddDetailWinUI.data("kendoWindow").open();
                 $('#apps_add_detail_win').data("kendoWindow").wrapper.find('.k-i-close').off().click(function(e){
                    e.stopPropagation();
                    if(feedbackDetail.ratings > 0){
                        // dialog = $('#dialog');
                        // dialog.kendoWindow({
                        //     width:400,
                        //     height:88,
                        //     title:"Detail",
                        //     visible:false,
                        //     modal: true,
                        //     resizable: false,
                        //     actions: ["Close"],
                        //     close:function(){
                        //        dialog.destroy;
                        //     }
                        // });
                        
                        // dialog.data("kendoWindow").center();
                        // dialog.data("kendoWindow").open();
                        // if(useragent == 'ipad'){
                        //      $('#for_ipad').append('#dialog{display:block!important}');
                        // }

                        Workport.utils.alertMsg("Detail",'The given rating will not reflect without entering review comments. Are you sure you want to close the pop-up?',"Yes",function(_is){
                            if(_is==true){
                                $('#apps_add_detail_win').data("kendoWindow").close();
                            }
                        });
                       
                    }else{
                        $('#apps_add_detail_win').data("kendoWindow").close();
                    }
                });
                
            },
            // onClickOkBtn:function(){
            //     dialog.data("kendoWindow").close();
            //     $('#apps_add_detail_win').data("kendoWindow").close();
            //     if(useragent == 'ipad'){
            //          $('#for_ipad').append('#dialog{display:none!important}');
            //     }
            // },
            // onClickCancelBtn:function(){
            //     dialog.data("kendoWindow").close();
            //     if(useragent == 'ipad'){
            //          $('#for_ipad').append('#dialog{display:none!important}');
            //     }
            //     // $("#apps_add_detail_win_comment_textarea").kendoTooltip({
            //     //     content: "Must enter Review comment.",
            //     //     position: "right",
            //     //     hide: function() {
            //     //         $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').destroy();
            //     //     }
            //     // });
            //     // appsAddDetailWinFunc.apps_add_detail_win_comment_input_click($("#apps_add_detail_win_comment_input"));
            //     // $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').show();
            // },
            apps_add_detail_win_rate_click : function (num) {
                feedbackDetail.ratings = num + 1;
                for (var i = 0; i < 5; i++) {
                    if (i <= num) {
                        if ($("#apps_add_detail_win_rate i:eq(" + i + ")").hasClass("main_smartstream_h_10_10")) {
                            $("#apps_add_detail_win_rate i:eq(" + i + ")").toggleClass("main_smartstream_h_10_10 main_smartstream_g_10_10");
                        }
                    } else {
                        if ($("#apps_add_detail_win_rate i:eq(" + i + ")").hasClass("main_smartstream_g_10_10")) {
                            $("#apps_add_detail_win_rate i:eq(" + i + ")").toggleClass("main_smartstream_h_10_10 main_smartstream_g_10_10");
                        }
                    }
                }
            },
            apps_add_detail_win_comment_input_click : function (element) {
                $(element).hide();
                $("#apps_add_detail_win_comment_textarea").show();
                $("#apps_add_detail_win_comment_textarea").focus();
                $("#apps_add_detail_win_comment_button").show();
                feedbackDiv.css("height", '85px');
            },

            apps_add_detail_win_reply_button_click : function (argument) {
                feedbackDetail.feedback = $.trim($("#apps_add_detail_win_comment_textarea").val());
                if (!feedbackDetail.feedback) {
                    $("#apps_add_detail_win_comment_textarea").kendoTooltip({
                        content: "Must enter Review comment.",
                        position: "right",
                        hide: function() {
                            $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').destroy();
                        }
                    });
                    $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').show();

                    return;
                }else if(feedbackDetail.ratings < 1){
                    $("#apps_add_detail_win_rate").kendoTooltip({
                        content: "Must rate this application.",
                        position: "right",
                        hide: function() {
                            $("#apps_add_detail_win_rate").data('kendoTooltip').destroy();
                        }
                    });
                    $("#apps_add_detail_win_rate").data('kendoTooltip').show();
                    return
                }else if(feedbackDetail.feedback.length>255){
                    $("#apps_add_detail_win_comment_textarea").kendoTooltip({
                        content: "The comment length must be less than 255.",
                        position: "right",
                        hide: function() {
                            $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').destroy();
                        }
                    });
                    $("#apps_add_detail_win_comment_textarea").data('kendoTooltip').show();
                }
                loading.show();
                feedbackDetail.timeofPost = kendo.toString(new Date(), 'F');
                Workport.AppAPI.saveFeedback(function (data) {
                    loading.hide();
                    if ($.inArray(data.ResponseCode, appsToolsWinResponseSuccessCode) == -1) {
                       alertMsg(data.ResponseMessage);
                    } else {
                        // appsAddDetailWinUI.data("kendoWindow").close();
                        appsAddDetailWinFunc.apps_add_detail_win_create(feedbackDetail.appId);
                        feedbackDiv.css("height", '130px');
                        replyFlag = true;
                    }
                }, feedbackDetail);
            },
            apps_tools_win_create_launch_click : function () {
                // appsAddDetailWinUI.data("kendoWindow").close();
                loading.show();
                Workport.AppAPI.postLaunchCount(function (data) {
                    loading.hide();
                    if (data.ResponseCode != "WP1008") {
                        alertMsg(data.ResponseMessage);
                    } else {
                        $("#apps_add_detail_win_content_users_count").text(data.UserLaunchCount);
                        wp_apps_tools.refreshLaunchByPopWin(feedbackDetail.appId, data.UserLaunchCount)
                        window.open(appsAddDetailWinViewModel.detailInfo.AppUrl);
                    }
                }, {"appId": feedbackDetail.appId});
                // wp_iframe_win.openIframWindow(appsAddDetailWinViewModel.detailInfo.AppUrl, appsAddDetailWinViewModel.detailInfo.AppTitle);
            },
            like_icon_clicked_event : function () {
                loading.show();
                Workport.AppAPI.saveLike(function(data){
                    loading.hide();
                    if (data.ResponseCode == "WP1022") {
                        if (data.IsLikedByMe) {
                            $("#apps_add_detail_win_like_icon").removeClass("app_tools_f_10_10");
                            $("#apps_add_detail_win_like_icon").addClass("main_smartstream_t_8_8");
                            $("#apps_add_detail_win_like_icon").attr("title","Like");
                        } else {
                            $("#apps_add_detail_win_like_icon").removeClass("main_smartstream_t_8_8");
                            $("#apps_add_detail_win_like_icon").addClass("app_tools_f_10_10");
                            $("#apps_add_detail_win_like_icon").attr("title","Unlike");
                        }
                        $("#apps_add_detail_win_content_likes_count").text(data.totalLikes);
                        if(data.totalLikes>0){
                            $('#apps_add_detail_win_content_likes_count').css("cursor","pointer");
                        }else{
                            $('#apps_add_detail_win_content_likes_count').css("cursor","");
                        }
                        wp_apps_tools.refreshLikeByPopWin(feedbackDetail.appId, data.IsLikedByMe, data.totalLikes);
                    } else {
                        alertMsg.alertMsg(data.ResponseMessage);
                    }
                }, {"appId": feedbackDetail.appId});
            },
            like_person_num_clicked_event : function (num) {
                if (num > 0) {
                    loading.show();
                    Workport.AppAPI.getLikeUser(function(data){
                        loading.hide();
                        if (data.ResponseCode == "WP1022") {
                            wp_all_liked_users.openUserListWindow(data.Likedusers);
                        } else {
                            alertMsg.alertMsg(data.ResponseMessage);
                        }
                    }, {"appId": feedbackDetail.appId, "count": 10, "offset": 0});
                }
            },
            clickfeedbackcommenticon:function(){
                //$('#apps_add_detail_win_feedbacks_table').toggle();
            }

            // apps_add_detail_win_edit_button_click : function () {
            //     appsToolsCreateWin.apps_tools_win_create();
            //     appsAddDetailWinUI.data("kendoWindow").close();
            // },

            // apps_add_detail_win_del_click : function () {
            //     Workport.utils.alertMsg(alertTitle, "Do you want to delete the application?", "Yes", function (_data){
            //         if(_data==true){
            //             Workport.AppAPI.deleteApp(function (data) {
            //                 if ($.inArray(data.ResponseCode, appsToolsWinResponseSuccessCode) == -1) {
            //                     alertMsg(data.ResponseMessage);
            //                 } else {
            //                     appsAddDetailWinUI.data("kendoWindow").close();
            //                 }
            //             }, {"appId": feedbackDetail.appId, "action": "Delete"});
            //         }
            //     });
            // }
        };
    })();
</script>